﻿Imports System.Data.OleDb
Imports System.Data
Public Class updateprofile
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim tUsername As String = Context.User.Identity.Name
        Dim conn = New OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings("fishconn").ConnectionString)
        conn.Open()
        Dim cmd As OleDbCommand = New OleDbCommand("SELECT [FirstName], [LastName], [EmailAddress], [Address], [State], [Country], [Gender], [DateofBirth], [PhoneNumber], [Description], [ProfilePicturesmall], [Interest], [DisplayMessage] FROM [tblProfile] WHERE ([UserName] = ?);", conn)
        cmd.Parameters.AddWithValue("@username", tUsername)
        Dim rs As OleDbDataReader = cmd.ExecuteReader
        If rs.Read() Then
            txtFname.Text = rs(0).ToString
            txtLname.Text = rs(1).ToString
            txtemail.Text = rs(2).ToString
            txtaddress.Text = rs(3).ToString
            txtState.Text = rs(4).ToString
            txtcountry.Text = rs(5).ToString
            If rs(6).ToString = "F" Then
                cbxSex.SelectedIndex = 1
            Else
                cbxSex.SelectedIndex = 0
            End If
            Dim str As String
            str = rs(7).ToString
            If str <> "" Then
                Dim datebirth As Date
                datebirth = rs(7)
                txtDOB.Text = datebirth.ToString("yyyy-MMM-dd")
            End If

            txtphone.Text = rs(8).ToString
            txtDescription.Text = rs(9).ToString
            txtdisplaymessage.Text = rs(12).ToString
            TxtInterest.Text = rs(11).ToString

        End If
    End Sub

    Protected Sub ImageButton1_Click(sender As Object, e As ImageClickEventArgs) Handles ImageButton1.Click
        Response.Redirect("~/Account/manage.aspx")
    End Sub
End Class